home *** CD-ROM | disk | FTP | other *** search
/ An Introduction to Progr…l Basic 6.0 (4th Edition) / An Introduction to Programming using Visual Basic 6.0.iso / COMMON / TOOLS / VB / CABINETS / MSDAO350.CAB / icontrols / BorderDisplayer.class (.txt) next >
Encoding:
Java Class File  |  1998-01-08  |  1.7 KB  |  55 lines

  1. package icontrols;
  2.  
  3. import com.ms.wd.ui.Brush;
  4. import com.ms.wd.ui.Graphics;
  5. import com.ms.wd.ui.Pen;
  6. import com.ms.wd.ui.Rectangle;
  7. import com.ms.wd.win32.Windows;
  8.  
  9. public class BorderDisplayer {
  10.    public static final int BS_SINGLELINE = 1;
  11.    public static final int BS_3DLINE = 2;
  12.    public static final int BS_NONE = 4;
  13.    public static final int BS_SUNKEN = 16;
  14.    public static final int BS_RAISED = 32;
  15.    private int m_nBorderStyle = 18;
  16.  
  17.    public int getBorderHeight() {
  18.       return this.getBorderWidth();
  19.    }
  20.  
  21.    public int getBorderWidth() {
  22.       if ((this.m_nBorderStyle & 2) == 2) {
  23.          return 2;
  24.       } else {
  25.          return (this.m_nBorderStyle & 1) == 1 ? 1 : 0;
  26.       }
  27.    }
  28.  
  29.    public void paintIn(Graphics g, Rectangle bounds, Rectangle clipRect) {
  30.       if ((this.m_nBorderStyle & 4) != 4) {
  31.          if ((this.m_nBorderStyle & 2) == 2) {
  32.             int nStyle = 5;
  33.             if ((this.m_nBorderStyle & 16) == 16) {
  34.                nStyle = 10;
  35.             }
  36.  
  37.             Windows.DrawEdge(g.getHandle(), bounds.toRECT(), nStyle, 15);
  38.          } else {
  39.             g.setBrush((Brush)null);
  40.             g.setPen(Pen.BLACK);
  41.             g.drawRect(bounds);
  42.          }
  43.  
  44.       }
  45.    }
  46.  
  47.    public void setBorderStyle(int nStyle) {
  48.       this.m_nBorderStyle = nStyle;
  49.    }
  50.  
  51.    public int getBorderStyle() {
  52.       return this.m_nBorderStyle;
  53.    }
  54. }
  55.